
public class Day{

    private int day,month,year;
    Day(){
        day=1;
        month=1;
        year=1998;
    }

    Day(int i,int j,int k){
        day =i;
        month=j;
        year=k;
    }

    Day(Day d){
        day=d.day;
        month=d.month;
        year=d.year;

    }

    public String dayPrint(){
        return(year+"/"+month+"/"+day);
    }

    public Day tomorrow(){
        Day d=new Day(this);
        d.day++;
        if(d.day>d.dayIn()){
            d.day=1;
            d.month++;
            if(d.month>12){
                d.month=1;
                d.year++;
            }
        }

        return d;
    }

    public int dayIn(){

        if(month<=0 || month>12)return -1;

        switch(month){
            case 1:
            case 3:
            case 5:
            case 7:
            case 8:
            case 10:
            case 12:
                return 31;

            case 4:
            case 6:
            case 9:
            case 11:
                return 30;
            
            default: 
                if ((year%4==0&&year%100!=0)||year %400==0) {
                    return 29;
                }else{
                    return 28;
                }
        }

    }

    public static void main(String[] args) {
        Day d1=new Day();
        Day d2=new Day(31,8,2019);
        Day d3=new Day(d2);
        System.out.println(d1.dayPrint());
        System.out.println(d3.dayPrint());

        System.out.println(d3.tomorrow().dayPrint());
    }
}
